package com.wf.config;


import com.wf.interceptor.RateLimitInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * 配置WebMvcConfigurer的实现类，用于注册拦截器
 */
@Configuration
@Slf4j
public class  WebMvcConfiguration implements WebMvcConfigurer {



    @Autowired
    RateLimitInterceptor rateLimitInterceptor;

    /**
     * 添加拦截器，配置拦截路径和排除路径
     * @param registry 拦截器注册对象
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(rateLimitInterceptor).addPathPatterns("/**");
    }



}
